//
//  LMapScene.m
//  TouchDemo
//
//  Created by 李明明 on 16/2/25.
//  Copyright © 2016年 李明明. All rights reserved.
//

#import "LMapScene.h"
#import <MapKit/MapKit.h>
#import <SceneKit/SceneKit.h>
#import "LLocation.h"
@interface LMapScene ()<MKMapViewDelegate>
@property (nonatomic, strong) MKMapView *map;
@property (nonatomic, strong) UIView *bgView;
@property (nonatomic, strong) LLocation *local;
@end

@implementation LMapScene
@synthesize map, bgView, local;
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    local = [LLocation singleInstanse];
    // Do any additional setup after loading the view.
    bgView = [[UIView alloc] initWithFrame:self.view.bounds];
    bgView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:bgView];
    [self makeMap];
}
- (void)makeMap {
    map = [[MKMapView alloc] initWithFrame:self.view.bounds];
    map.mapType = MKMapTypeStandard;
    map.zoomEnabled = YES;
    map.scrollEnabled = YES;
    map.rotateEnabled = NO;
    map.delegate = self;
    [bgView addSubview:map];
    map.showsUserLocation = YES;
    map.visibleMapRect = MKMapRectMake(50, 50, 100, 100);
}
- (void)mapViewWillStartLoadingMap:(MKMapView *)mapView {
    NSLog(@"%@", mapView);
    [mapView setCenterCoordinate:local.coor animated:YES];
}
/**
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    SCNView *scene = [[SCNView alloc] initWithFrame:self.view.bounds];
    scene.allowsCameraControl = YES;
    UIImage *image = [scene snapshot];
    UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
    imageView.frame = CGRectMake(100, 100, 160, 320);
    [self.view addSubview:imageView];
}
 */
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
